import {
  createStore
} from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import mutations from './mutations'
import actions from './actions'
import getters from './getters'
// import {
//   cart,
//   user,
//   catagory
// } from './modules'
import cart from './modules/cart'
import user from './modules/user'
import catagory from './modules/catagory'
import state from './state'

export default createStore({
  state,
  mutations,
  actions,
  modules: {
    cart,
    user,
    catagory
  },
  getters,
  plugins: [
    // 默认存储在localStorage
    createPersistedstate({
      key: 'erabbit-client-pc-store',
      paths: ['user', 'cart']
    })
  ]
})
